package com.bridgeintelligent.tag.mapper;

import com.bridgeintelligent.tag.webserver.dim.mgmt.api.DimCatalog;
import com.bridgeintelligent.tag.webserver.dim.mgmt.api.DimData;
import com.bridgeintelligent.tag.webserver.dim.mgmt.api.DimDataDel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * Created by JackCheung on 2019/9/12 3:04 PM.
 */
@Mapper
public interface DimFreeMapper {

    /**
     * 新增自定义标签
     *
     * @param dim
     */
    void add(DimData dim);

    /**
     * 查找标签列表
     *
     * @param createrId
     * @param theme
     * @param dimName
     * @param department
     * @param state
     * @param createTimeStart
     * @param createTimeEnd
     * @param uptTimeStart
     * @param uptTimeEnd
     * @param approveState
     * @return
     */
    List<DimData> findList(@Param("createrId") String createrId, @Param("theme") String theme, @Param("dimName") String dimName, @Param("department") String department, @Param("state") String state, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd, @Param("uptTimeStart") String uptTimeStart, @Param("uptTimeEnd") String uptTimeEnd, @Param("approveState") String approveState);

    /**
     * 超管-查找标签列表
     *
     * @param createrId
     * @param theme
     * @param dimName
     * @param department
     * @param state
     * @param createTimeStart
     * @param createTimeEnd
     * @param uptTimeStart
     * @param uptTimeEnd
     * @param approveState
     * @return
     */
    List<DimData> findUnionAdminList(@Param("createrId") String createrId, @Param("theme") String theme, @Param("dimName") String dimName, @Param("department") String department, @Param("state") String state, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd, @Param("uptTimeStart") String uptTimeStart, @Param("uptTimeEnd") String uptTimeEnd, @Param("approveState") String approveState);



    /**
     * 查找删除标签列表
     *
     * @param createrId
     * @param theme
     * @param dimName
     * @param department
     * @param state
     * @param createTimeStart
     * @param createTimeEnd
     * @param uptTimeStart
     * @param uptTimeEnd
     * @return
     */
    List<DimDataDel> findDelList(@Param("createrId") String createrId, @Param("theme") String theme, @Param("dimName") String dimName, @Param("department") String department, @Param("state") String state, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd, @Param("uptTimeStart") String uptTimeStart, @Param("uptTimeEnd") String uptTimeEnd);

    /**
     * 修改自定义标签的审核状态
     *
     * @param dimId
     * @param approvalState
     */
    void updateApprovaleState(@Param("dimId") String dimId, @Param("approvalState") String approvalState);
    /**
     * 修改自定义标签的审核状态
     *
     * @param dimId
     * @param approvalState
     */
    void updateApproveState(@Param("dimId") String dimId, @Param("approvalState") String approvalState, @Param("approveDate") String approveDate);

    /**
     * 获取审批列表
     *
     * @return
     */
//    List<DimData> findApproveList(@Param("theme") String theme,@Param("dimName") String dimName,@Param("department") String department,@Param("approveState") String approveState,@Param("createTimeStart") String createTimeStart,@Param("createTimeEnd") String createTimeEnd,@Param("uptTimeStart") String uptTimeStart,@Param("uptTimeEnd") String uptTimeEnd,@Param("catalogId") String catalogId,List<String> resourceIds);
    List<DimData> findApproveList(Map map);


    /**
     * 更新标签
     *
     * @param dimData
     */
    void updateBaseInfo(DimData dimData);

    DimData findByDimId(String dimId);

    /**
     * 定制标签发布到私有目录下
     * @param map
     */
    void updCatalog(Map<String,String> map);

    DimCatalog findCatalogName(String dName);

    /**
     * 查询表里定制标签当前最大的标签排序号
     * @param type
     * @return
     */
    Integer findMaxOwerSortNum(String type);

    @Select("select id from TAG_UPLOAD_HDFS_LOG where filetype = #{filetype} and status = #{status}")
    List<String> findErrorFiles(@Param("filetype") String filetype,@Param("status") String status);
}
